# coding=utf-8
"""
作者：董新强 
创建时间：
描述：
"""
import json

from db_models.apps.applications import Applications
from framework.db_session import DbSession

APP_INFO_DICT = {}  # APPID:
with DbSession.create() as db:
    query = db.query(Applications)
    for v in query:
        APP_INFO_DICT[v.app_key] = (v.id, v.app_secret, json.loads(v.allow_ips, encoding='utf-8'))


def get_allow_ips(appid):
    return APP_INFO_DICT.get(appid)
